﻿@using QuestionsAnswers.UI.Models
@model IEnumerable<QuestionsAnswers.UI.Models.Course>
<table>
    <tr>
        <th>
            Course
        </th>
        <th>
            Creator
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td style="text-align: left">
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Creator.UserName)
            </td>
            <td>
                @if (item.CanModify(User.Identity.Name))
                {
                    @Ajax.ActionLink("Edit", "Edit", "Course", new { id = item.CourseId }, new AjaxOptions { OnSuccess = "OnSuccessCreate" })
                    @:|
                     @Html.ConfirmLink("Delete", "Course", "Delete", new { id = item.CourseId }, "Really Delete?")
                    @:|
                     @Html.ActionLink("View Questions", "CourseQuestions", "Course", new { id = item.CourseId }, null)@:|
          
                                 }
            </td>
        </tr>
    }
</table>
